function new_vid= imaqdevice_ChangeFcn(old_vid, Adaptor, DeviceID, Format)
%VIDSOURCE1_SELECTIONCHANGEDFCN Summary of this function goes here
%   Detailed explanation goes here

% we have to delete a old vid
if ~isempty(old_vid)
    delete(old_vid)
end

try
    new_vid = videoinput(Adaptor, DeviceID, Format);
catch ex
    %TODO maybe write a warning
    new_vid = [];
end

end

